package Assignment;

import java.util.Scanner;

public class Test6 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入x:");
        int x = scanner.nextInt();
        System.out.print("请输入y:");
        int y = scanner.nextInt();

        System.out.print("请输入您要进行的运算(1:表示加法,2:表示减法,3:表示乘法,4:表示除法): ");
        String operation = scanner.next();

        switch (operation) {
            case "+":
                System.out.println(x + " " + operation + " " + y + " = " + (x+y));
                break;
            case "-":
                System.out.println(x + " " + operation + " " + y + " = " + (x-y));
                break;
            case "*":
                System.out.println(x + " " + operation + " " + y + " = " + (x*y));
                break;
            case "/":
                if (y != 0) {
                    System.out.println(x + " " + operation + " " + y + " = " + (x/y));
                } else {
                    System.out.println("被除数为0，无意义");
                }

                break;
            default:
                System.out.println("运算符错误！");
        }

    }
}
